package com.etc.dao;

import com.etc.pojo.EmpMst;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {

    @Select(" select id, emp_name, `password`, user_name as username, sex, age \n" +
            "from emp_mst   ")
    List<EmpMst> selectAll();

    @Insert(" insert into emp_mst values(null, #{empName}, #{password}, #{username}, #{sex}, #{age}) ")
    int add(EmpMst empMst);


    int deleteById(int id);

//    @Select
    List<EmpMst> findByCondition(EmpMst emp);

    @Select(" select id, emp_name, `password`, user_name as username, sex, age \n" +
            "from emp_mst where user_name = #{username}  ")
    EmpMst selectByUsername(EmpMst emp);
}
